home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Wipes reversed ƒ / Quadrant scroll 2 reversed.c < prev    next >
Text File  |  1994-04-19  |  4KB  |  102 lines

  1. /**********************************************************************\
  2.  
  3. File:        Quadrant scroll 2 reversed.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 3
  28. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  29. #define theWindowWidth (boundsRect.right-boundsRect.left)
  30. #define NUM_ITERATIONS    25
  31.  
  32. pascal short QuadrantScroll2Reversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  33.  
  34. /* 4 regions, splitting the screen into 4 quadrants.  Scroll the screen down in
  35.    the top-left quadrant, right in the top-right, up in the bottom-right,
  36.    left in the bottom-left. */
  37.    
  38. pascal short QuadrantScroll2Reversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  39. {
  40.     int            x;
  41.     Rect        tlsource, trsource, blsource, brsource;
  42.     Rect        tldest, trdest, bldest, brdest;
  43.     Rect        tlscroll, trscroll, blscroll, brscroll;
  44.     int            cx,cy;
  45.     int            BoxSize, HBoxSize;
  46.     
  47.     BoxSize=theWindowHeight/(NUM_ITERATIONS*2);
  48.     HBoxSize=theWindowWidth/(NUM_ITERATIONS*2);
  49.     
  50.     cx = boundsRect.left + theWindowWidth / 2;
  51.     cy = boundsRect.top + theWindowHeight / 2;
  52.     
  53.     tlscroll=trscroll=blscroll=brscroll=tldest=trdest=bldest=brdest=boundsRect;
  54.     tlscroll.right=trscroll.left=blscroll.right=brscroll.left=
  55.         tldest.right=trdest.left=bldest.right=brdest.left=cx;
  56.     tlscroll.bottom=trscroll.bottom=blscroll.top=brscroll.top=
  57.         tldest.bottom=trdest.bottom=bldest.top=brdest.top=cy;
  58.     brdest.bottom=brdest.top+BoxSize;
  59.     trdest.right=trdest.left+HBoxSize;
  60.     tldest.top=tldest.bottom-BoxSize;
  61.     bldest.left=bldest.right-HBoxSize;
  62.     SetRect(&tlsource, boundsRect.left, boundsRect.top, cx, boundsRect.top+BoxSize);
  63.     SetRect(&blsource, boundsRect.left, cy, boundsRect.left+HBoxSize, boundsRect.bottom);
  64.     SetRect(&brsource, cx, boundsRect.bottom-BoxSize, boundsRect.right, boundsRect.bottom);
  65.     SetRect(&trsource, boundsRect.right-HBoxSize, boundsRect.top, boundsRect.right, cy);
  66.     
  67.     for (x=0; x<NUM_ITERATIONS; x++)
  68.     {
  69.         StartTiming();
  70.         ScrollTheRect(&trscroll, HBoxSize, 0, 0L);
  71.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  72.                 &trsource, &trdest, 0, 0L);
  73.         trsource.left-=HBoxSize;
  74.         trsource.right-=HBoxSize;
  75.         
  76.         ScrollTheRect(&brscroll, 0, BoxSize, 0L);
  77.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  78.                 &brsource, &brdest, 0, 0L);
  79.         brsource.top-=BoxSize;
  80.         brsource.bottom-=BoxSize;
  81.         
  82.         ScrollTheRect(&blscroll, -HBoxSize, 0, 0L);
  83.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  84.                 &blsource, &bldest, 0, 0L);
  85.         blsource.left+=HBoxSize;
  86.         blsource.right+=HBoxSize;
  87.         
  88.         ScrollTheRect(&tlscroll, 0, -BoxSize, 0L);
  89.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  90.                 &tlsource, &tldest, 0, 0L);
  91.         tlsource.top+=BoxSize;
  92.         tlsource.bottom+=BoxSize;
  93.         
  94.         TimeCorrection(CorrectTime);
  95.     }
  96.     
  97.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  98.         &boundsRect, &boundsRect, 0, 0L);
  99.     
  100.     return 0;
  101. }
  102.